<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>AI 聊天页面</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: system-ui, sans-serif, "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji";
        }

        body {
            background-color: #f4f4f4;
            display: flex;
            flex-direction: column;
            align-items: center;
            min-height: 100vh;
            padding: 20px;
        }

        .chat-container {
            width: 100%;
            max-width: 600px;
            min-height: 100vh;
            background: white;
            border-radius: 10px;
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
            display: flex;
            flex-direction: column;
        }

        .header {
            background: #0078d7;
            color: white;
            padding: 15px;
            text-align: center;
            font-size: 16px;
            font-weight: bold;
        }

        .header p {
            font-size: 14px;
            margin-top: 5px;
        }

        .chat-box {
            padding: 15px;
            display: flex;
            flex-direction: column;
        }

        .message {
            display: flex;
            align-items: flex-start;
            margin-bottom: 15px;
            max-width: 100%;
        }

        .message img {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            margin-right: 10px;
        }

        /* AI思考文本（去掉头像，对齐 AI 回复框） */
        .thinking-box {
            background: #f0f0f0;
            color: #666;
            font-style: italic;
            border-radius: 10px;
            padding: 10px 14px;
            max-width: 80%;
            font-size: 14px;
            margin-bottom: 5px;
            margin-left: 50px; /* 让它和 AI 回复对齐 */
        }

        /* AI实际回复文本 */
        .ai .reply-box {
            background: #2196f3;
            color: #fff;
            border-radius: 10px;
            padding: 10px 14px;
            max-width: 80%;
            font-size: 14px;
            word-wrap: break-word;
        }

        /* 用户消息 */
        .user {
            flex-direction: row-reverse;
        }

        .user img {
            margin-left: 10px;
            margin-right: 0;
        }

        .user .text-box {
            background: #dcedc8;
            color: #333;
            border-radius: 10px;
            padding: 10px;
            max-width: 80%;
            font-size: 14px;
            word-wrap: break-word;
        }

        .footer {
            text-align: center;
            padding: 10px;
            font-size: 12px;
            color: #666;
        }

        /* Token 统计框 */
        .tokens-box, .thinking-time {
            font-size: 12px;
            color: #999;
            margin-top: 5px;
        }
    </style>
</head>
<body>
    <div class="chat-container">
        <div class="header">
            AI 聊天室
            <p>QQ群：{{Group}} | QQ号：{{QQ}}</p>
        </div>

        <div class="chat-box">
            <!-- 用户发送的消息 -->
            <div class="message user">
                <img src="http://q2.qlogo.cn/headimg_dl?dst_uin={{QQ}}&spec=100" alt="用户头像">
                <div class="text-box">{{usersmg}}</div>
            </div>

            <!-- AI 正在思考（去掉头像，文本框对齐 AI 回复） -->
            <div class="message">
                <div class="thinking-box">{{chatskao}}</div>
            </div>

            <!-- AI 回复（有头像） -->
            <div class="message ai">
                <img src="http://q2.qlogo.cn/headimg_dl?dst_uin={{ChatQQ}}&spec=100" alt="AI头像">
                <div>
                    <div class="reply-box">{{chatmsg}}</div>
                    <div class="thinking-time">思考耗时：秒</div>
                    <div class="tokens-box">本次回答Tokens：18</div>
                </div>
            </div>
        </div>

        <div class="footer">
            页面生成时间：<span id="time"></span>
        </div>
    </div>

    <script>
        // 设置页面生成时间
        document.getElementById("time").textContent = new Date().toLocaleString();
    </script>
</body>
</html>